/**
 * gwt-validator 
 *
 * Copyright (C) 2006  Nikolaus Rumm, Christian Simonutti
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package gwt.validator.client.exception;

import java.util.ArrayList;
import java.util.List;

/**
 * The <code>ValidationException</code> class represents an exception that is
 * raised to signal validation issues.
 * 
 * It consists of a sorted collection of validation issues. Thus there's a
 * one-to-many relationship between the <code>ValidationException</code> and
 * the <code>ValidationIssue</code>s. This means that a single validation
 * exception will transport at least one, but possibly more, validation issues.
 * 
 * @author Nikolaus Rumm
 */
public class ValidationException extends RuntimeException {
	/**
	 * The validation issues
	 */
	private List issues;

	/**
	 * Constructor
	 */
	public ValidationException() {
		this.issues = new ArrayList();
	}

	/**
	 * Constructor
	 * 
	 * @param aIssues
	 *            The issues
	 */
	public ValidationException(List aIssues) {
		this();
		this.issues = aIssues;
	}

	/**
	 * Adds the given issue to this exception.
	 * 
	 * @param aIssue
	 *            The issue
	 */
	public void addIssue(ValidationIssue aIssue) {
		this.issues.add(aIssue);
	}

	/**
	 * Read-accessor for the issues.
	 */
	public List getIssues() {
		return this.issues;
	}
}
